package com.prothink.service.impl;

import com.prothink.dao.JsCourseClassDao;
import com.prothink.entity.CourseClass;
import com.prothink.service.JsCourseClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName : JsCourseClassServiceImpl  //类名
 * @Description :   //描述
 * @Author : Zhang //作者
 * @Date: 11/23  9:10
 */
@Service
public class JsCourseClassServiceImpl implements JsCourseClassService {
    @Autowired
    private JsCourseClassDao jsCourseClassDao;
    @Override
    public List<CourseClass> getCourseClass() {
        List<CourseClass> courseClass = jsCourseClassDao.getCourseClass(0);
        for (int i = 0; i < courseClass.size(); i++) {
            List<CourseClass> courseClass1 = jsCourseClassDao.getCourseClass(courseClass.get(i).getId());
            if (courseClass1 != null){
                courseClass.get(i).setChildrenList(courseClass1);
            }else{
                continue;
            }
        }
        return courseClass;
    }
}
